package hibernate.billStream;

import hibernate.p.Pair;
import hibernate.p.Unit;
import java.util.Date;
import java.util.StringTokenizer;
import hibernate.roomSystem.Room;

public class AccommodatingRec 
extends ExpenseRec{
	
	private String note;
	private boolean countByHour;
	private Pair price=new Pair();
	private Long id;
	private Room room;
	private ConcreteBill bill;
	
	public void setBill(ConcreteBill bill){this.bill=bill;}
	
	public ConcreteBill getBill(){return this.bill;}
	
	public void setNote(String note){
		this.note=note;
	}
	
	public String getNote(){
		return note;
	}
	
	public void setCountByHour(boolean ifCountByHour){
		countByHour=ifCountByHour;
	}
	
	public boolean getCountByHour(){
		return countByHour;
	}
	
	public Double getPrice(){
		return ((Double)price.getFirst()).doubleValue();
	}
	
	public void setPrice(Double info){
		this.price.setFirst(info);
	}
	
	public Unit getPriceUnit(){
		return ((Unit)this.price.getSecond());
	}
	
	public void setPriceUnit(String unit){
		this.price.setSecond(Unit.parseUnit(unit));
	}
	
	public void setId(Long id){
		this.id=id;
	}
	
	public Long getId(){
		return id;
	}
	
	public void setRoom(Room room){
		this.room=room;
	}
	
	public Room getRoom(){
		return room;
	}
	
	public Commodity getCommodity() {
		// TODO Auto-generated method stub
		return ((Commodity)this.room);
	}

	public String getName() {
		// TODO Auto-generated method stub
		return room.getName();
	}

	public Pair getTotalPrice() {
		// TODO Auto-generated method stub
		double total=0;
		total=timeFrom.compareTo(timeTo)/(1000*3600*24);
		total=((double)total)*((Double)room.getUnitPrice().getFirst()).doubleValue();
		return new Pair(total,room.getUnitPrice().getSecond());
	}

	public int getUnitNr() {
		// TODO Auto-generated method stub
		return 0;
	}
	
	public boolean equals(Object obj){
		if(!(obj instanceof AccommodatingRec))
			return false;
		else return this.id.equals(((AccommodatingRec)obj).id);
	}
	
}
